﻿#region License
// (c) Intergen.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
#endregion

using System;
using System.Xml.Linq;
using System.Collections.Generic;

namespace TextGlow.Control.Model
{
  public class BlockStructuredTag : DocumentContent
  {
    public static readonly XName Name = Document.WordprocessingML + "sdt";

    private readonly List<DocumentContent> _content = new List<DocumentContent>();

    public List<DocumentContent> Content
    {
      get { return _content; }
    }

    public BlockStructuredTag(Content parent, XElement element)
      : base(parent)
    {
      if (element == null)
        throw new ArgumentNullException("element");

      XNamespace ns = element.Name.Namespace;

      XElement contentElement = element.Element(ns + "sdtContent");

      _content.AddRange(DocumentContent.Create(parent, contentElement.Elements()));
    }
  }
}